home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / COMMADIO / BRAIN.LZH / BRAIN.DOC next >
Text File  |  1987-04-01  |  22KB  |  539 lines

  1.  
  2.                                 The Brain
  3.                                Version 3.0
  4.                       Created in 1986 by Chris Jenks
  5.  
  6.   In return for a $15 contribution I will send you a disk containing  the 
  7. latest  compiled  version  of  The Brain,  the Basic source code in ASCII 
  8. format,  the documentation,  and a list of variables used  in  Brain  and 
  9. their  descriptions.  The source code has many comments and the variables 
  10. are easy to recognize.  To run the  source  code  you  will  need  BASICA 
  11. version A2.00. My address is:
  12.  
  13.  
  14.  
  15.                            Chris Jenks
  16.                            1324 Bobwhite Avenue
  17.                            Sunnyvale, CA. 94087
  18.  
  19.  
  20.  
  21.   This program was designed to do work on a bulletin board which is  busy 
  22. without needing to be present.  However,  there are many applications for 
  23. which  this  program  could  be  used,   such  as   electronic  mail,  or 
  24. transferring files, at any time of day or night.
  25.   Before you use The Brain,  you must create a file called COMMAND.DAT in 
  26. an  editor  and save it on the default drive.  This file will contain the 
  27. instructions which tell The Brain what to do. This program can hold up to 
  28. 500  commands.  When The Brain is run,  it reads this file and makes sure 
  29. everything will work (Checks syntax,  makes  sure  files  to  upload  are 
  30. available,  etc.),  and  then  it  executes  the commands.  Later in this 
  31. documentation is a list of all the commands The Brain can use, as well as 
  32. their descriptions and some examples.
  33.   Except in the Message and Send commands,  spaces are completely ignored 
  34. by the compiler, and so is the case of the command. However, each command 
  35. must be on its own line. There need not be commands on comment lines.
  36.   The  function  keys  can  be  used to put the keyboard on line with the 
  37. modem, to skip the next command in the command file,  to edit the command 
  38. file,  or  to terminate the program prematurely and return to DOS.  While 
  39. editing the command file you can cause The Brain to jump to another point 
  40. in  the  command  file,  you can save the revised command file (under the 
  41. name COMMAND.DAT), or you can restart The Brain program.  These functions 
  42. are displayed at the bottom of the screen.
  43.   After  each  command  below  are  the parameters.  A parameter given in 
  44. brackets ([]) is mandatory,  and if it is omitted,  an error will  result 
  45. when  the command file is checked for errors.  A parameter in braces ({}) 
  46. is optional. If it is not specified, a default will be used.  The default 
  47. is given in parenthesis () next to the parameter. After the command is an 
  48. explanation of it,  and sometimes there are three examples of how it  can 
  49. be used.
  50.  
  51.   The commands are:
  52.  
  53. *
  54.  
  55.   Is  used  before  a  remark.  It  can be put on a blank line of after a 
  56. command other than MESSAGE or SEND.
  57.  
  58.   For example:
  59.     * This is a remark.
  60.       Will be completely ignored by the compiler. It won't even be 
  61.       counted as a line unless it is on the same line as a command.
  62.     DOWNLOAD HIDEFILE.BAS * Download a utility program.
  63.       Will download the file as if the comment weren't there.
  64.     SEND 5, Yes        * This answers the question `Lower case?'
  65.       Will send  the line " Yes        * This answers the question `Lower
  66.       case?'" to the remote computer and might mess  things  up.  If  you
  67.       need  to have a comment for a send line,  put the comment before or
  68.       after the line.
  69.  
  70. SCREEN ON
  71.  
  72.   Starts sending the data received over  the  modem  to  the  screen.  It
  73. continues to do this until the SCREEN OFF command is received.
  74.  
  75. SCREEN OFF
  76.  
  77.   Clears the screen and stops sending data received over the modem to it.
  78.  
  79. MESSAGE {TEXT ()}{;()}
  80.  
  81.   Prints the text on the screen,  but does not send it over the modem  or 
  82. to the dump file.  If a semicolon is appended to the text,  the text will 
  83. be printed without a carriage return on the end. If no text is specified, 
  84. a blank line will be produced.
  85.  
  86.   For example:
  87.     MESSAGE Now dialing computer system...
  88.       Would print " Now dialing computer system..." on the screen, 
  89.       followed by a carriage return. Notice the leading space. All spaces 
  90.       and tabs leading the text in the command are left in when the  text 
  91.       is printed.
  92.     MESSAGESemicolon;;
  93.     MESSAGE
  94.       Would print "Semicolon;" on the  screen,  followed  by  a  carriage 
  95.       return (from the second message command).
  96.     MESSAGE...hit F2 and type your password...;
  97.       Would print "...hit F2 and type your password..." on the screen 
  98.       without a carriage return.
  99.  
  100. WAIT UNTIL [hour]:{minutes (00)}:{seconds (00)}{AM/PM (AM)}
  101.  
  102.   Waits  until the specified time until going on to the next instruction. 
  103. Make sure your computer's clock is set right.  The time you  specify  for 
  104. this command can be in just about any format you like.  You don't have to 
  105. use the colon to separate the hours,  minutes,  and seconds.  You can use 
  106. any  non-numeric  character (except the space),  and military time can be 
  107. used.  To prevent text from being burnt into the screen, use a SCREEN OFF 
  108. command before the WAIT UNTIL command to clear the screen. After the WAIT 
  109. UNTIL command you can turn the screen back on with SCREEN ON.
  110.  
  111.   For example:
  112.     WAIT UNTIL 2
  113.       Would wait until 2 AM.
  114.     WAIT UNTIL 2:00:30 PM
  115.       Would wait until 30 seconds past 2 PM.
  116.     WAIT UNTIL 14/00
  117.       Would wait until 2 PM.
  118.  
  119. REPORT
  120.  
  121.   Starts  sending  statuses  to  a  file  named REPORT.DAT on the default
  122. drive. If the file already exists The Brain will append to it.
  123.   Statuses are produced whenever a command is executed. It is usually the 
  124. time the command is executed and what  the  command  is.  It  also  gives 
  125. errors  received while transferring files.  Be sure you have enough space 
  126. on the disk to hold the finished report.  The  file  will  require  about 
  127. forty bytes per command executed.
  128.  
  129. NEW REPORT
  130.  
  131.   This  command is the same as REPORT except that if REPORT.DAT exists it 
  132. will be erased, and then a new REPORT.DAT file will be created and filled 
  133. with the report information generated.
  134.  
  135. NO REPORT
  136.  
  137.   Stops sending reports to the REPORT.DAT file.
  138.  
  139. DUMP [file]
  140.  
  141.   Starts  dumping everything that comes from the modem into the specified 
  142. file.  This command can be used for ASCII downloads.  If  the  dump  file 
  143. already exists, it will be appended to.  It continues to dump information 
  144. until the CLOSE DUMP command is reached. The information sent to the dump 
  145. file is not formatted by the CHANGE command.
  146.  
  147.   For example:
  148.     DUMP LPT1:
  149.       Starts printing everything that comes over the modem.
  150.     DUMP SCRN:
  151.       Dumps everything to the screen.  This has the same  effect  as  the 
  152.       SCREEN command.
  153.     DUMP OUTPUT.TXT
  154.       Creates the  file  OUTPUT.TXT  and  starts  building  it  with  the
  155.       received information.
  156.  
  157. NEWDUMP [file]
  158.  
  159.   The  same  as  the  DUMP  command  except that if the dump file already 
  160. exists, it will be erased and a new file created.
  161.  
  162. CLOSE DUMP
  163.  
  164.   Stops  sending  output to the file specified with the DUMP command.  If
  165. there was no DUMP file specified before this command,  the compiler  will
  166. return an error message.
  167.  
  168. OPEN AT  {commport (1)},{speed (1200)},{parity (N)},{data bits (8)},{stop
  169. bits (1)}
  170.  
  171.   Opens the modem at the specified port. This must be done before you can 
  172. use SEND, CHARSEND, MULTI DIAL, DOWNLOAD, UPLOAD, or OUT. If the modem is 
  173. already open when this command  is  executed,  it  is  closed,  and  then 
  174. reopened at the new setting. In this way you can switch baud rates.
  175.  
  176.   For example:
  177.     OPEN AT
  178.       Opens the modem on the COM1:  port, at 1200 baud, no parity, 8 data 
  179.       bits, and 1 stop bit.
  180.     OPEN AT 2, 300, E, 7
  181.       Opens the modem on the COM2: port, at 300 baud, even parity, 7 data 
  182.       bits, and 1 stop bit.
  183.     OPEN AT 1, 75, S, 5, 2
  184.       Opens the modem on the COM1: port, at 75 baud, space parity, 5 data 
  185.       bits, and 2 stop bits.
  186.  
  187. CHANGE [ASCII code of character to replace],{ASCII of replacement (0)}
  188.  
  189.   This command  can  be  used  to  rid  the  received  text  of  unwanted 
  190. characters. The first parameter, the character to be replaced, is changed 
  191. to the second parameter, the replacement character, if it is given. If it 
  192. is not given, or if the replacement character is zero, then the character 
  193. will be completely removed from the received text.  This will not  affect 
  194. an X-modem transfer, nor will it affect text put into the dump file.
  195.  
  196.   For example:
  197.     CHANGE 65
  198.       Will cause any capital A's received not to appear on the screen.
  199.     CHANGE 7,14
  200.       Will make a note symbol come up on the screen whenever a bell is 
  201.       received over the modem.
  202.     CHANGE 10
  203.       This  would remove line feeds from received text.  If you don't put 
  204.       this command into your command file,  you  may  get  double  spaced 
  205.       lines  if  the computer you call sends both a carriage return and a 
  206.       line feed as a line terminator.
  207.  
  208. SEND {delay in seconds (10)}{,;(,)}{text()}
  209.  
  210.   This command will wait the specified number of seconds after  data  has 
  211. stopped coming over the modem before sending the text.  If any data comes 
  212. over the modem while it is waiting, it will start waiting again.  This is 
  213. done  so that this program won't send text while the program on the other 
  214. end is sending text. The delay should be considered carefully. Too short, 
  215. and  the data sent could be lost,  and the call may be wasted.  Too long, 
  216. and the computer on the other end may hang up because of the long  delay.     
  217.   This is one of the few cases in which spaces and case matter. The Brain 
  218. will send the text exactly as you type  it.  You  must  put  a  new  SEND 
  219. command for each line you want to send. You can use this command to enter 
  220. commands and messages on the host computer.
  221.   If you include the delay,  you must also put a comma (,)  or  semicolon 
  222. (;)  after the number to separate the delay from the text.  If you do not 
  223. use a comma or semicolon, the entire line, starting with the number, will 
  224. be  sent.  If you use a comma,  a carriage return will be appended to the 
  225. end of the line. If you use a semicolon, no carriage return will be sent. 
  226. Make  sure  that  if  you  need  to  send a number followed by a comma or 
  227. semicolon to the host computer that you include the  delay  in  the  SEND 
  228. command.  If  you incluse a comma or semicolon without the delay then the 
  229. delay will be zero.
  230.  
  231.   For example:
  232.     SEND 5,Yes
  233.       Waits for the computer on the other end of the line to stop sending 
  234.       for 5 seconds,  then sends the text "Yes" with a carriage return to 
  235.       answer a question.
  236.     SEND ;Type of computer:
  237.       This command has a delay of zero,  and it sends the string "Type of 
  238.       computer:" to the host computer without a carriage return.
  239.     SEND I'm testing my new communications program.
  240.       Sends the sentence:  " I'm testing my new communications  program." 
  241.       to be put into a message after a ten second delay. Notice the space 
  242.       after SEND is included in the sent text.
  243.  
  244. CHARSEND [ASCII code],{ASCII code},{ASCII code}...
  245.  
  246.   Sends a list of characters over the modem.
  247.  
  248.   For example:
  249.     CHARSEND 65
  250.       Will send an "A" over the modem.
  251.     CHARSEND 8,8,8
  252.       Sends three backspaces over the modem.
  253.     CHARSEND 12
  254.       Sends a form feed to the host computer.
  255.  
  256. REDIAL {delay in seconds (20)},[phone number]
  257.  
  258.   Redials a number until the number answers.  After dialing it waits  the
  259. specified  number  of  seconds to receive a carrier before hanging up and
  260. dialing again. After receiving a carrier the programs goes on to the next
  261. instruction.
  262.  
  263.   For example:
  264.     REDIAL (123) 456-7890
  265.       Dials the number, waits 20 seconds for a carrier, then hangs up and
  266.       dials it again.
  267.     RE DIAL 35, 1234567890
  268.       Dials the number and waits 35 seconds for a carrier.
  269.     REDIAL 30, 456-7890
  270.       Dials the number and waits 30 seconds for a carrier.
  271.  
  272. MULTI DIAL {delay in seconds (20)}
  273. [phone numbers]
  274. END LIST
  275. [instructions]
  276. NEXT DIAL
  277.  
  278.   This will dial a list of phone numbers. It will call the first one, and 
  279. if it is busy go on to the next one,  and so on throughout the  list.  If 
  280. one  of  them  answers it will mark it and go on to the instruction after 
  281. END LIST and continue to go through the  instructions  until  it  reaches 
  282. NEXT  DIAL,  which  will tell it to go back to the MULTI DIAL command and 
  283. dial the next number.  Once all the numbers have answered it will  go  to 
  284. the  instruction  after NEXT DIAL.  You can even have more than one MULTI 
  285. DIAL in a program,  but make sure to put a NEXT DIAL  after  every  MULTI 
  286. DIAL and before the next MULTI DIAL.  This function can be used to call a 
  287. large list of numbers without having to worry about getting  stuck  on  a 
  288. busy one. Each phone number after MULTI DIAL should be on its own line.
  289.  
  290.   For example:
  291.     MULTI DIAL 30
  292.     423-1658          * Bulletin board numbers
  293.     334-6233
  294.     424-4547
  295.     453-8367
  296.     END LIST
  297.     SEND 5,
  298.                       * <CR>'s to get past initial messages
  299.     SEND 5,
  300.     SEND 5,John
  301.                       * Caller's first name
  302.     SEND 5,Jones
  303.                       * Caller's last name
  304.     SEND 5,SECRET
  305.                       * Caller's password
  306.     SEND 5,
  307.                       * <CR>'s to go past more messages
  308.     SEND 5,
  309.     SEND 5,G
  310.                       * Say goodbye
  311.     WAIT 5            * Wait for board to hang up
  312.     NEXT DIAL         * Dial next number
  313.     END
  314.  
  315.       Will  call  423-1658 and wait 30 seconds for a carrier.  If none is
  316. received,  it will call 334-6233.  If a carrier is received this time  it
  317. will  mark  334-6233  to indicate that it has already answered and not to
  318. call it next time.  Then it will log onto and log off of the board,  then
  319. it will go back and call 423-1658,  and if it doesn't answer it will call
  320. 424-4547. After all four numbers have answered, it will go on to END.
  321.  
  322. IF [parameters] THEN [command]
  323.  
  324.   The  IF  statement  is  used only after a MULTI DIAL statement has been 
  325. given.  It allows you to do something if a certain group of numbers  have 
  326. been called. The parameters are integers separated by commas. The command 
  327. is any command listed, even another IF,  or an END,  or even REDIAL.  The 
  328. integer parameters stand for the position a particular phone number given 
  329. in MULTI DIAL is in.
  330.  
  331.   For example:
  332.     MULTI DIAL
  333.     423-1658                            * Number 1
  334.     334-6233                            * Number 2
  335.     424-4547                            * Number 3
  336.     453-8367                            * Number 4
  337.     END LIST
  338.     IF 1,2 THEN SEND 5,Y
  339.     IF 1,2,4 THEN SEND 5,N
  340.     IF 3 THEN DUMP TEXT.TXT
  341.     SEND 5,
  342.     IF 1 THEN SEND 5,John;Jones;SECRET
  343.     IF 2,3,4 THEN SEND 5,John;Jones;PASSWORD
  344.     SEND 5,
  345.     SEND 5,
  346.     SEND 5,G
  347.     WAIT 10
  348.     NEXT DIAL
  349.     CLOSE DUMP
  350.     END
  351.       Will call the four numbers sequentially,  and when one  answers  it
  352.       will go on to the next step.  As you can see in the comments above,
  353.       the phone numbers are each assigned a number,  and this is used  in
  354.       an IF statement.  It will send a "Y" to 423-1658 and 334-6233,  but
  355.       not to 424-4547 or 453-8367.
  356.  
  357. DOWNLOAD [file]
  358.  
  359.   Creates  the  specified  file  and downloads the contents.  The file is
  360. downloaded using the X-Modem protocol.
  361.  
  362.   For example:
  363.     DOWNLOAD BRAIN.ARC
  364.       Will create BRAIN.ARC on the default drive.
  365.     DOWNLOAD B:BRAIN.ARC
  366.       Will create BRAIN.ARC on the B drive.
  367.     DOWNLOAD BRAIN
  368.       Will  download  BRAIN.    on  the  default drive,  and it has to be
  369.       renamed BRAIN.ARC before it can be unpacked.
  370.  
  371. UPLOAD [file]
  372.  
  373.   Sends a file to the host computer. When The Brain is first run, it will 
  374. make sure that the specified file exists,  and if it is missing an  error 
  375. message will appear. The file is uploaded using the X-Modem protocol.
  376.  
  377.   For example:
  378.     UPLOAD BRAIN.ARC
  379.       Will  read  BRAIN.ARC off the default drive and send it to the host
  380.       computer.
  381.     UPLOAD B:BRAIN.ARC
  382.       Will read BRAIN.ARC off the  B  drive  and  send  it  to  the  host
  383.       computer.
  384.     UPLOAD BRAIN
  385.       Will  read  the  file  BRAIN.    off  the default drive and,  if it
  386.       exists, send it to the host computer.
  387.  
  388. OUT [file]
  389.  
  390.   Sends a file to the host computer. The file sent will be checked for in
  391. the compiler, and if it is missing an error message will appear. The file
  392. is sent in ASCII.  This can be used to enter a message on the  other  end
  393. from text in a file.
  394.  
  395.   For example:
  396.     OUT MESSAGE.TXT
  397.       Will  read  MESSAGE.TXT  from the default drive and send it line by
  398.       line over the modem.
  399.     OUT B:TEXT.TXT
  400.       Will  read  TEXT.TXT  from  the  B  drive  and  send it to the host
  401.       computer.
  402.     OUT BRAIN.EXE
  403.       Would probably result in a run time error because the  lines  send,
  404.       which end in a carriage return, can't be over 255 characters long.
  405.  
  406. WAIT [time]
  407.  
  408.   Waits  for  the  number  of  seconds specified where time is a positive 
  409. integer, regardless of received text.  Text received is still sent to the 
  410. specified outputs.
  411.  
  412.   For example:
  413.     WAIT 5
  414.       Waits 5 seconds until proceeding.
  415.     WAIT 0
  416.       Accomplishes absolutely nothing.
  417.     WAIT -1
  418.       Returns an error message in the compiler.
  419.  
  420. COUNT [number of times] and ENDLOOP
  421.  
  422.   Repeats  a given sequence a given number of times.  The number of times 
  423. can be an integer from one to 32767.  After the COUNT command  is  given, 
  424. ordinary  commands follow,  and then the command END LOOP to tell it when 
  425. to go back to the corresponding COUNT command.  The Brain can go  through 
  426. 25 COUNT commands before needing to execute an ENDLOOP command.
  427.  
  428.   For example:
  429.     COUNT 5
  430.     SEND 10,
  431.     END LOOP
  432.       Would be the same as typing:
  433.       SEND 10,
  434.       SEND 10,
  435.       SEND 10,
  436.       SEND 10,
  437.       SEND 10,
  438.     END LOOP
  439.     SEND 5,
  440.     COUNT 5
  441.       Would  cause  an  error  because all END LOOP's must be preceded by 
  442.       COUNT statements.
  443.     COUNT 3
  444.     SEND 5, Yes
  445.     COUNT 2
  446.     SEND 5,
  447.     END LOOP
  448.     END LOOP
  449.       Would be the same as typing:
  450.       SEND 5, Yes
  451.       SEND 5,
  452.       SEND 5,
  453.       SEND 5, Yes
  454.       SEND 5,
  455.       SEND 5,
  456.       SEND 5, Yes
  457.       SEND 5,
  458.       SEND 5,
  459.  
  460. JUMP [Lines away]
  461.  
  462.   When this command is received,  the interpreter will go to line X+lines 
  463. away, where X is the line that the JUMP command is on.
  464.  
  465.   For example:
  466.     JUMP -1
  467.       Will cause  the  line  before  the  JUMP  command  to  be  repeated 
  468.       indefinitely.
  469.     JUMP 0
  470.       Will make the computer sit there and sit there and sit there...
  471.     JUMP 2
  472.       Will cause the interpreter to skip the next line.
  473.  
  474. END
  475.  
  476.   Closes all open files and returns to the system or Basic.
  477.  
  478.   Here  is  an example of what the COMMAND.DAT file would look like if we 
  479. wanted to call an RBBS-PC bulletin board,  enter a message on the  board, 
  480. and log off of the board:
  481.  
  482. Screen OFF                * Clear screen and turn off cursor.
  483. Wait until 1 AM           * When rates are lowest!
  484. Screen ON                 * So if I'm around I can see what's happening.
  485. Report                    * In case something goes wrong.
  486. Dump B:DUMP.TXT           * I can look over what happened the next day.
  487. Open at                   * 1, 1200, N, 8, 1
  488. Change 10                 * Keep line feeds from printing on the screen.
  489. Send 5,
  490.                           * Make sure modem is listening.
  491. Send 5,ATM0
  492.                           * Turn off modem speaker (It's 1 AM!)
  493. Redial 30, (215) 935-4114 * RBBS phone number.
  494. Count 3                   * Unnecessary. Still uses 3 lines.
  495. Send 5,
  496. End loop                  * To get past initial messages.
  497. Send John
  498.                           * Answer "First name?"
  499. Send Jones
  500.                           * Answer "Last name?"
  501. Send SECRET
  502.                           * Answer "Password?"
  503. Send 15,
  504.                           * More (Y)/N/NS? on welcome.
  505. Send
  506.                           * C/R to pass bulletins.
  507. Send E
  508.                           * Enter message.
  509. Send 5,
  510.                           * C/R if addressed to "All".
  511. Send 5,Announcement
  512.                           * Subject.
  513. Send 5,N
  514.                           * No protection.
  515. Send 5,  I have just made a program to replace the programmer! It dials a
  516. Send 5,board, loggs onto it, enters this message, and loggs off, all by
  517. Send 5,itself!
  518. Send 5,
  519.                           * Blank line when done entering message.
  520. Send 5,S
  521.                           * Save the message.
  522. Send 5,G
  523.                           * Goodbye.
  524. Close dump                * Just for neatness.
  525. No report
  526. Screen OFF
  527. End
  528.  
  529.   After  this  file  is created in an editor,  just put it on the default 
  530. drive under the name COMMAND.DAT and execute BRAIN.EXE.  The  Brain  will 
  531. check  the  file to make sure everything is spelled right and such.  This 
  532. section of the program has been referred to as the compiler,  although it 
  533. really  only formats the commands.
  534.   If  you receive several error messages in the compiler,  try to fix the
  535. first one, and then compile it again. Some errors are caused by a mistake
  536. earlier in the command file. For instance, if you get an error on an OPEN
  537. AT statement,  you will get errors on all commands after that which  need
  538. to interface with the modem, like SEND.
  539.